package cn.chochy.my.controller;

import cn.chochy.my.model.BAttribute;
import cn.chochy.my.model.Blogs;
import cn.chochy.my.model.PaginationBean;
import cn.chochy.my.model.UserInfo;
import cn.chochy.my.service.BAttributeService;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.apache.commons.logging.impl.Log4JLogger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 *
 * @author MLeo
 */
@Controller
public class AjaxController {

    @Resource
    private BAttributeService attributeService;

    Log4JLogger logger = new Log4JLogger(this.getClass().getName());

    @RequestMapping(value = "/ajax")
    @ResponseBody
    public PaginationBean ajax(PaginationBean pagination, UserInfo user, BAttribute attribute) {
        logger.error("error+++++++++++++++");

        List<UserInfo> list = new ArrayList<UserInfo>();
        for (int i = 0; i < pagination.getPageSize(); i++) {
            list.add(user);
        }

        pagination.setList(list);
        pagination.setDataCount(10000000);

        List<BAttribute> attributeList = attributeService.queryList(attribute);
        System.out.println(attributeList.size() + "&&&&&&&&&&&&&&");

        return pagination;
    }

}
